<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Vertx::AsyncFile
  
    &mdash; Ruby API Doc
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (A)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Vertx.html" title="Vertx (module)">Vertx</a></span></span>
     &raquo; 
    <span class="title">AsyncFile</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: Vertx::AsyncFile
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Vertx::AsyncFile</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2"><span class='object_link'><a href="ReadStream.html" title="Vertx::ReadStream (module)">ReadStream</a></span>, <span class='object_link'><a href="WriteStream.html" title="Vertx::WriteStream (module)">WriteStream</a></span></dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">src/main/api_shim/core/file_system.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    Represents a file on the file-system which can be read from, or written to asynchronously.
The class also includes <span class='object_link'><a href="ReadStream.html" title="Vertx::ReadStream (module)">ReadStream</a></span> and <span class='object_link'><a href="WriteStream.html" title="Vertx::WriteStream (module)">WriteStream</a></span> - this allows the data to be pumped to and from
other streams, e.g. an <span class='object_link'><a href="HttpClientRequest.html" title="Vertx::HttpClientRequest (class)">HttpClientRequest</a></span> instance, using the <span class='object_link'><a href="Pump.html" title="Vertx::Pump (class)">Pump</a></span> class

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Author:</p>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><a href="http://tfox.org" target="_parent" title="Tim Fox">Tim Fox</a></div>
      
    </li>
  
</ul>

</div>






  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#close-instance_method" title="#close (instance method)">- (Object) <strong>close</strong>(&amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Close the file, asynchronously.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#flush-instance_method" title="#flush (instance method)">- (Object) <strong>flush</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Flush any writes made to this file to underlying persistent storage, asynchronously.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#read_at_pos-instance_method" title="#read_at_pos (instance method)">- (Object) <strong>read_at_pos</strong>(buffer, offset, position, length, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Reads some data from a file into a buffer, asynchronously.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#write_at_pos-instance_method" title="#write_at_pos (instance method)">- (Object) <strong>write_at_pos</strong>(buffer, position, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Write a <span class='object_link'><a href="Buffer.html" title="Vertx::Buffer (class)">Buffer</a></span> to the file, asynchronously.</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="ReadStream.html" title="Vertx::ReadStream (module)">ReadStream</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="ReadStream.html#data_handler-instance_method" title="Vertx::ReadStream#data_handler (method)">#data_handler</a></span>, <span class='object_link'><a href="ReadStream.html#end_handler-instance_method" title="Vertx::ReadStream#end_handler (method)">#end_handler</a></span>, <span class='object_link'><a href="ReadStream.html#exception_handler-instance_method" title="Vertx::ReadStream#exception_handler (method)">#exception_handler</a></span>, <span class='object_link'><a href="ReadStream.html#pause-instance_method" title="Vertx::ReadStream#pause (method)">#pause</a></span>, <span class='object_link'><a href="ReadStream.html#resume-instance_method" title="Vertx::ReadStream#resume (method)">#resume</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="WriteStream.html" title="Vertx::WriteStream (module)">WriteStream</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="WriteStream.html#drain_handler-instance_method" title="Vertx::WriteStream#drain_handler (method)">#drain_handler</a></span>, <span class='object_link'><a href="WriteStream.html#exception_handler-instance_method" title="Vertx::WriteStream#exception_handler (method)">#exception_handler</a></span>, <span class='object_link'><a href="WriteStream.html#write-instance_method" title="Vertx::WriteStream#write (method)">#write</a></span>, <span class='object_link'><a href="WriteStream.html#write_queue_full%3F-instance_method" title="Vertx::WriteStream#write_queue_full? (method)">#write_queue_full?</a></span>, <span class='object_link'><a href="WriteStream.html#write_queue_max_size-instance_method" title="Vertx::WriteStream#write_queue_max_size (method)">#write_queue_max_size</a></span>, <span class='object_link'><a href="WriteStream.html#write_queue_max_size%3D-instance_method" title="Vertx::WriteStream#write_queue_max_size= (method)">#write_queue_max_size=</a></span></p>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="close-instance_method">
  
    - (<tt>Object</tt>) <strong>close</strong>(&amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Close the file, asynchronously.

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


111
112
113</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/file_system.rb', line 111</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_close identifier id'>close</span><span class='lparen token'>(</span><span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_close identifier id'>close</span><span class='lparen token'>(</span><span class='rubyid_ARWrappedHandler constant id'>ARWrappedHandler</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="flush-instance_method">
  
    - (<tt>Object</tt>) <strong>flush</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Flush any writes made to this file to underlying persistent storage, asynchronously.
If the file was opened with flush set to true then calling this method will have no effect.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>hndlr</span>
      
      
        <span class='type'>(<tt>Block</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a block representing the handler which is called on completion.</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


141
142
143
144</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/file_system.rb', line 141</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_flush identifier id'>flush</span>
  <span class='rubyid_Future constant id'>Future</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_flush identifier id'>flush</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="read_at_pos-instance_method">
  
    - (<tt>Object</tt>) <strong>read_at_pos</strong>(buffer, offset, position, length, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Reads some data from a file into a buffer, asynchronously.
When multiple reads are invoked on the same file
there are no guarantees as to order in which those reads actually occur.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>buffer</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Buffer.html" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The buffer into which the data which is read is written.</div>
      
    </li>
  
    <li>
      
        <span class='name'>offset</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The position in the buffer where to start writing the data.</div>
      
    </li>
  
    <li>
      
        <span class='name'>position</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The position in the file where to read the data.</div>
      
    </li>
  
    <li>
      
        <span class='name'>length</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The number of bytes to read.</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


133
134
135
136</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/file_system.rb', line 133</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_read_at_pos identifier id'>read_at_pos</span><span class='lparen token'>(</span><span class='rubyid_buffer identifier id'>buffer</span><span class='comma token'>,</span> <span class='rubyid_offset identifier id'>offset</span><span class='comma token'>,</span> <span class='rubyid_position identifier id'>position</span><span class='comma token'>,</span> <span class='rubyid_length identifier id'>length</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_read identifier id'>read</span><span class='lparen token'>(</span><span class='rubyid_buffer identifier id'>buffer</span><span class='dot token'>.</span><span class='rubyid__to_java_buffer identifier id'>_to_java_buffer</span><span class='comma token'>,</span> <span class='rubyid_offset identifier id'>offset</span><span class='comma token'>,</span> <span class='rubyid_position identifier id'>position</span><span class='comma token'>,</span> <span class='rubyid_length identifier id'>length</span><span class='comma token'>,</span> <span class='rubyid_ARWrappedHandler constant id'>ARWrappedHandler</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='rubyid_j_buff identifier id'>j_buff</span><span class='bitor op'>|</span> <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_j_buff identifier id'>j_buff</span><span class='rparen token'>)</span> <span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="write_at_pos-instance_method">
  
    - (<tt>Object</tt>) <strong>write_at_pos</strong>(buffer, position, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Write a <span class='object_link'><a href="Buffer.html" title="Vertx::Buffer (class)">Buffer</a></span> to the file, asynchronously.
When multiple writes are invoked on the same file
there are no guarantees as to order in which those writes actually occur.
starts with zero at the beginning of the file.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>buffer</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Buffer.html" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The buffer to write</div>
      
    </li>
  
    <li>
      
        <span class='name'>position</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The position in the file where to write the buffer. Position is measured in bytes and</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


121
122
123
124</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/file_system.rb', line 121</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_write_at_pos identifier id'>write_at_pos</span><span class='lparen token'>(</span><span class='rubyid_buffer identifier id'>buffer</span><span class='comma token'>,</span> <span class='rubyid_position identifier id'>position</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
  <span class='rubyid_@j_del ivar id'>@j_del</span><span class='dot token'>.</span><span class='rubyid_write identifier id'>write</span><span class='lparen token'>(</span><span class='rubyid_buffer identifier id'>buffer</span><span class='dot token'>.</span><span class='rubyid__to_java_buffer identifier id'>_to_java_buffer</span><span class='comma token'>,</span> <span class='rubyid_position identifier id'>position</span><span class='comma token'>,</span> <span class='rubyid_ARWrappedHandler constant id'>ARWrappedHandler</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Wed Jul 17 20:30:37 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.6.1 (ruby-1.9.3).
</div>

  </body>
</html>